﻿CREATE TABLE [dbo].[t_optimization_visitor_comment]
(
    [id] UNIQUEIDENTIFIER NOT NULL, 
    [visitor_id] UNIQUEIDENTIFIER NOT NULL,
    [registered_user_id] UNIQUEIDENTIFIER,
    [category_key] VARCHAR(2048) NOT NULL, -- e.g. page visit, page ranking, product keyword search, product paging search and etc.
    [category_value] NVARCHAR(2048), -- the detailed content of category key
    [parent_id] UNIQUEIDENTIFIER, -- the parent comment if exist
    [content] NVARCHAR(2048), -- user inputted comment
    [score] INT, -- like or dislike score
    [created] DATETIMEOFFSET NOT NULL, 
    [created_by] NVARCHAR(64) NOT NULL, 
    [modified] DATETIMEOFFSET NOT NULL, 
    [modified_by] NVARCHAR(64) NOT NULL, 
    [row_version] TIMESTAMP NOT NULL, 
    CONSTRAINT [pk_t_optimization_visitor_comment] PRIMARY KEY NONCLUSTERED ([id]) 
)

GO

CREATE CLUSTERED INDEX [ix_t_optimization_visitor_comment_created] ON [dbo].[t_optimization_visitor_comment] ([created])
